<?php
/**
 * @filename CoffeeWithhook.php
 * @author LD King
 * @encoding UTF-8
 * @date 2008-9-8 | 下午12:30:36
 * @package 08-Template
 * @subpackage 
 * @usage 示例 hook(钩子) 的用法
 * @note 
 * @copyright Copyright (c) 2007 - 2008 LD (http://mifunny.info)
 * @version $Id: $
 */

include_once 'CaffeineBeverage.php';

/**
 * 咖啡版hook方法
 *
 */
class CoffeeWithHook extends CaffeineBeverage {
	
	/**
	 * @see CaffeineBeverage::customerWantsCondiments()
	 *
	 * @return boolean
	 */
	public function customerWantsCondiments() {
	?>
<form method="post">
	<input type="radio" checked="checked" name="Condiment" value="yes" /> 需要调料
	<br />
	<input type="radio" name="Condiment" value="no" /> 不要调料
	<br /> 
	<input type="submit" />
</form>
<?php
		if ($_POST['Condiment'] == 'yes') {
			return true;
		}else {
			return false;
		}		
	}
	
	/**
	 * @see CaffeineBeverage::addCondiment()
	 *
	 */
	public function addCondiment() {
		echo "With Hook: Adding Sugar and Milk.<br />";
	}
	
	/**
	 * @see CaffeineBeverage::brew()
	 *
	 */
	public function brew() {
		echo "With Hook: Dripping Coffee through filter.<br />";
	}
}
?>